package com.xiehua.task.job.pool;

import java.util.UUID;

public class DelayJob extends Job{

    private static final long serialVersionUID = 1L;

    private Long ttr;//（time-to-run)：Job执行超时时间。单位：秒。

    private String body;//Job的内容，供消费者做具体的业务处理

    public static Long TTR_DEFAULT = 10L ;

    public DelayJob(){}

    public DelayJob(String topic,String jobBody,JobType type){
        this.topic = topic;
        this.body = jobBody;
        this.type = type;
        this.ttr = TTR_DEFAULT;
        this.status = JobStatus.delay;
    }

    public DelayJob(String topic,String jobBody,JobType type,Long ttr){
        this.topic = topic;
        this.body = jobBody;
        this.type =  type;
        this.ttr = ttr;
        this.status = JobStatus.delay;
    }

    public DelayJob(String topic,String jobBody,Long delay){
        this.topic = topic;
        this.body = jobBody;
        this.delay = delay;
        this.ttr = TTR_DEFAULT;
        this.type = JobType.delay;
        this.status = JobStatus.delay;
    }

    public Long getTtr() {
        return ttr;
    }

    public void setTtr(Long ttr) {
        this.ttr = ttr;
    }

    public String getBody() {
        return body;
    }

    public void setBody(String body) {
        this.body = body;
    }

    @Override
    public String toString() {
        return "DelayJob{" +
                "delay=" + delay +
                ", ttr=" + ttr +
                ", body='" + body + '\'' +
                ", reqId='" + reqId + '\'' +
                ", status=" + status +
                '}';
    }
}
